//
//  NIDropDown.h
//  TianjinAirline
//
//  Created by tan xin on 13-10-29.
//  Copyright (c) 2013年 eKing Technology. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum {
    PopupMenuUp = 0,
    PopupMenuDown = 1,
}MenuPopupDirection;

@class NIDropDown;
@protocol NIDropDownDelegate <NSObject>
@optional
- (void)niDropDownDelegateMethod:(NIDropDown *)sender didSelectedRow:(NSInteger)row;
- (void)niDropDownDelegateMethod:(NIDropDown *)sender didSelectedRow:(NSInteger)row detailRow:(NSInteger)detailRow;
@end

@interface NIDropDown : UIView <UITableViewDelegate, UITableViewDataSource>
{
    NSString *animationDirection;
    UIImageView *imgView;
}
@property (nonatomic, assign) id <NIDropDownDelegate> delegate;
@property (nonatomic, assign) MenuPopupDirection direction;
@property (nonatomic, assign) BOOL isPoped;

-(void)hideDropDown:(UIButton *)btn;
- (id)showDropDownFrom:(UIButton *)btn
            menuHeight:(CGFloat *)height
                titles:(NSArray *)arr
                 icons:(NSArray *)imgArr
             direction:(MenuPopupDirection)dir;

/**
 *  扩展的下拉列表，支持二级子列表
 *
 *  @param btn       触发的控件
 *  @param height    下拉列表的高度
 *  @param arr       一级列表的标题
 *  @param subTitles 一级列表各行对应的二级子列表标题
 *  @param dir       弹出方向
 *
 *  @return 生成的弹出控件
 */
- (id)showDropDownFrom:(UIButton *)btn
            menuHeight:(CGFloat *)height
                titles:(NSArray *)arr
             subTitles:(NSArray *)subTitles
             direction:(MenuPopupDirection)dir;
@end
